﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SD.IBUS;
using SD.Entities;
using System.Data;
using SD.IDAL;
using SD.DAL;

namespace SD.BUS
{
    public class ServiceBIZ:BaseBIZ,IServiceBIZ
    {       
        /// <summary>
        /// Get all service by includeInactive
        /// </summary>
        /// <param name="includeInactive"></param>
        /// <returns></returns>
        public DataTable GetAll(Boolean includeInactive)
        {
            IServiceDAO iserDAO = new ServiceDAO();
            DataTable dtResult = new DataTable();
            dtResult.Columns.Add("ServiceId");
            dtResult.Columns.Add("Name");

            List<Service> list = new List<Service>();
            list = iserDAO.GetAll(includeInactive);
            //If rows of list >0
            if (list.Count > 0)
            {
                //Get service from list service
                foreach (Service ser in list)
                {
                    dtResult.Rows.Add(ser.ServiceId, ser.Name);
                }
            }
            return dtResult;
        }
    }
}
